/*
 * Copyright (c) 2010 CCX(China) Co.,Ltd. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of
 * CCX(China) Co.,Ltd. ("Confidential Information").
 * It may not be copied or reproduced in any manner without the express 
 * written permission of CCX(China) Co.,Ltd.
 *
 * Author: zhaosj
 * Date: 2011-5-18 上午11:29:40
 */
package com.string;

/**
 * @author zhaosj
 * 
 */
public class StringTest {

	public void ascii2string(String str) {
		String s = "22307 35806 24555 20048";// ASCII码
		String[] chars = s.split(" ");
		for (int j = 0; j < chars.length; j++) {
			System.out.println(chars[j] + ":" + (char) Integer.parseInt(chars[j]));
		}

	}

	/**
	 * 字符串转换为ASCII码
	 * 
	 * @param str
	 */
	public void string2ascii(String str) {
		if (str == null)
			str = "你好";
		char[] c1 = str.toCharArray();
		long newStr = 0;
		for (int i = 0; i < c1.length; i++) {
			System.out.println(c1[i] + ":" + (int) c1[i]);
		}
	}

	public static void main(String[] args) {

		StringTest st = new StringTest();

		st.string2ascii(null);
	}

}
